﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SQLite;

namespace SQLiteDictionary
{
    public class SQLiteDictionaryInterop<TKey>
        where TKey : IEquatable<TKey>
    {
        public string DataBaseLocal
        { get; private set; }
        public SqliteDictionary<TKey, TValue> GetDictionary<TValue>()
        {
            return new SqliteDictionary<TKey, TValue>(DataBaseLocal);
        }

        public SQLiteDictionaryInterop(SQLiteDictionaryStorage StorageFolder, string DataBaseName)
        {
            DataBaseLocal = StorageLocal.GetPath(StorageFolder, DataBaseName);
        }
        public SQLiteDictionaryInterop(string DataBasePath)
        { DataBaseLocal = DataBasePath; }
        public SQLiteDictionaryInterop()
        { DataBaseLocal = "MySqliteDictionary"; }

        public bool ContainsKey<TValue>(TKey Key)
        {
            return GetDictionary<TValue>().ContainsKey(Key);
        }
        public bool Create<TValue>(TKey Key, TValue Value)
        { return GetDictionary<TValue>().Create(Key, Value); }
        public void Set<TValue>(TKey Key, TValue Value)
        { GetDictionary<TValue>().Set(Key, Value); }
        public bool Remove<TValue>(TKey Key)
        { return GetDictionary<TValue>().Remove(Key); }
        public TValue Get<TValue>(TKey Key)
        { return GetDictionary<TValue>().Get(Key); }
    }
}
